package com.tuyrt.hi.library.app

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
import android.widget.Toast
import com.tuyrt.hi.library.app.demo.HiLogDemoActivity
import com.tuyrt.hi.library.app.demo.SecondActivity
import com.tuyrt.hi.library.util.ActivityManager

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        ActivityManager.instance.addFrontBackCallback(object : ActivityManager.FrontBackCallback {
            override fun onChange(front: Boolean) {
                Toast.makeText(applicationContext, "切换为$front", Toast.LENGTH_SHORT).show()
            }
        })

        findViewById<TextView>(R.id.toSecond).setOnClickListener {
            startActivity(Intent(this, SecondActivity::class.java))
        }
        findViewById<TextView>(R.id.toLog).setOnClickListener {
            startActivity(Intent(this, HiLogDemoActivity::class.java))
        }
    }

}